package com.myBase.core.facade.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.myBase.core.entity.GoldcoinRelateRules;
import com.myBase.core.facade.service.EBaiGoldCoinInPutService;
import com.myBase.core.facade.service.EBeiGoldCoinInutServiceFacade;
import com.myBase.core.facade.service.GoldcoinRelateRulesServiceFacade;

@Service("eBeiGoldCoinInutServiceFacade")
public class EBeiGoldCoinInputServiceFacadeImpl implements EBeiGoldCoinInutServiceFacade {

    @Autowired
    private EBaiGoldCoinInPutService eBaiGoldCoinInPutService;//金币

    @Autowired
    private GoldcoinRelateRulesServiceFacade goldcoinRelateRulesServiceFacade;

    @Override
    @Transactional(readOnly = false, propagation = Propagation.REQUIRED, isolation = Isolation.REPEATABLE_READ, rollbackFor = Exception.class)
    public void saveAndupdate(Integer id, List<GoldcoinRelateRules> list, String subChannel) throws Exception {
        goldcoinRelateRulesServiceFacade.save(list);
        Integer updateStstus = eBaiGoldCoinInPutService.updateStstus(id, subChannel);
        if (updateStstus < 1) {
            throw new Exception("金币发行更新金币状态失败");
        }
    }

}
